<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>酒店首页</title>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
        }
        
        .header {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
            padding: 20px 0;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }
        
        .header-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .header-title {
            font-size: 24px;
            font-weight: 600;
            color: #333;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .header-title::before {
            content: "🏨";
            font-size: 28px;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 15px;
            background: rgba(255, 255, 255, 0.8);
            padding: 10px 20px;
            border-radius: 25px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            background: linear-gradient(45deg, #667eea, #764ba2);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 18px;
        }
        
        .user-name {
            font-weight: 500;
            color: #333;
        }
        
        .main-content {
            max-width: 1200px;
            margin: 120px auto 40px;
            padding: 0 20px;
        }
        
        .hotel-info {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 40px;
            margin-bottom: 40px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        
        .hotel-name {
            font-size: 36px;
            font-weight: 700;
            color: #333;
            margin-bottom: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 15px;
        }
        
        .hotel-name::before {
            content: "🏨";
            font-size: 42px;
        }
        
        .hotel-description {
            font-size: 18px;
            color: #666;
            line-height: 1.8;
            max-width: 800px;
            margin: 0 auto;
            text-align: left;
        }
        
        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 30px;
            margin-top: 40px;
        }
        
        .feature-card {
            background: rgba(255, 255, 255, 0.9);
            border-radius: 15px;
            padding: 30px;
            text-align: center;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        }
        
        .feature-icon {
            font-size: 40px;
            margin-bottom: 15px;
            display: block;
        }
        
        .feature-title {
            font-size: 20px;
            font-weight: 600;
            color: #333;
            margin-bottom: 10px;
        }
        
        .feature-desc {
            font-size: 14px;
            color: #666;
            line-height: 1.6;
        }
        
        .logout-btn {
            position: fixed;
            top: 20px;
            right: 20px;
            background: rgba(255, 255, 255, 0.9);
            border: none;
            padding: 10px 20px;
            border-radius: 25px;
            cursor: pointer;
            font-size: 14px;
            color: #666;
            transition: all 0.3s ease;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }
        
        .logout-btn:hover {
            background: #f5576c;
            color: white;
            transform: scale(1.05);
        }
        
        .welcome-section {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            padding: 30px;
            margin-bottom: 30px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            text-align: center;
        }
        
        .welcome-title {
            font-size: 28px;
            font-weight: 600;
            color: #333;
            margin-bottom: 10px;
        }
        
        .welcome-subtitle {
            font-size: 16px;
            color: #666;
        }
        
        .hotel-name.clickable {
            cursor: pointer;
            transition: color 0.2s, text-shadow 0.2s;
        }
        .hotel-name.clickable:hover {
            color: #5a3ec8;
            text-shadow: 0 2px 8px rgba(90,62,200,0.15);
            text-decoration: underline;
        }
        
        .user-action-btn {
            background: #f5f5f5;
            border: none;
            color: #5a3ec8;
            padding: 6px 16px;
            border-radius: 16px;
            margin-left: 8px;
            font-size: 14px;
            cursor: pointer;
            transition: background 0.2s, color 0.2s;
            text-decoration: none;
            display: inline-block;
        }
        .user-action-btn:hover {
            background: #e0e7ff;
            color: #333;
        }
        
        @media (max-width: 768px) {
            .header-content {
                flex-direction: column;
                gap: 15px;
            }
            
            .hotel-name {
                font-size: 28px;
                flex-direction: column;
                gap: 10px;
            }
            
            .hotel-description {
                font-size: 16px;
            }
            
            .features-grid {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
    <div class="header">
        <div class="header-content">
            <div class="header-title">酒店管理系统</div>
            <div class="user-info">
                <div class="user-avatar">U</div>
                <div class="user-name">用户：<span id="userName">用户</span></div>
                <a href="myorders.html" class="user-action-btn">我的订单</a>
                <a href="reviews.html" class="user-action-btn">查看评价</a>
                <button id="logoutBtn" class="user-action-btn" style="margin-left:5px;">退出登录</button>
            </div>
        </div>
    </div>
    
    <div class="main-content">
        <div class="welcome-section">
            <h1 class="welcome-title">欢迎光临！</h1>
            <p class="welcome-subtitle">感谢您选择我们的酒店服务</p>
        </div>
        
        <div class="hotel-info">
            <h1 class="hotel-name clickable" id="hotelName"></h1>
            <p class="hotel-description" id="hotelDescription"></p>
        </div>
        
        <div class="features-grid">
            <div class="feature-card">
                <span class="feature-icon">🛏️</span>
                <h3 class="feature-title">舒适住宿</h3>
                <p class="feature-desc">多种房型选择，现代化设施，确保您的住宿体验舒适便捷</p>
            </div>
            
            <div class="feature-card">
                <span class="feature-icon">🍽️</span>
                <h3 class="feature-title">优质餐饮</h3>
                <p class="feature-desc">提供丰富的早餐选择，让您的一天从美味开始</p>
            </div>
            
            <div class="feature-card">
                <span class="feature-icon">🚗</span>
                <h3 class="feature-title">便利交通</h3>
                <p class="feature-desc">位于市中心，交通便利，周边配套设施完善</p>
            </div>
            
            <div class="feature-card">
                <span class="feature-icon">💼</span>
                <h3 class="feature-title">商务服务</h3>
                <p class="feature-desc">24小时前台服务，商务中心，满足您的商务需求</p>
            </div>
        </div>
    </div>
    
    <script>
        // 获取用户名
        document.getElementById('userName').innerText = sessionStorage.getItem('adminName') || '用户';
        // 退出登录按钮事件
        $(document).on('click', '#logoutBtn', function() {
            if(confirm('确定要退出登录吗？')) {
                sessionStorage.removeItem('adminName');
                sessionStorage.removeItem('userId');
                window.location.href = 'login.html';
            }
        });
        
        // 页面加载时先清空内容或显示加载中
        document.getElementById('hotelName').innerText = '加载中...';
        document.getElementById('hotelDescription').innerText = '正在获取酒店信息...';

        // 从后端获取酒店信息
        $.ajax({
            url: 'http://localhost:8080/api/hotel/info',
            type: 'GET',
            success: function(data) {
                document.getElementById('hotelName').innerText = data && data.hotelName ? data.hotelName : '未设置酒店名';
                document.getElementById('hotelDescription').innerText = data && data.hotelDescription ? data.hotelDescription : '暂无酒店描述';
                console.log('酒店信息加载成功:', data);
            },
            error: function() {
                document.getElementById('hotelName').innerText = '获取失败';
                document.getElementById('hotelDescription').innerText = '无法获取酒店信息';
                console.error('获取酒店信息失败:');
            }
        });

        document.getElementById('hotelName').onclick = function() {
            window.location.href = 'hotel.html';
        };
        document.getElementById('hotelName').title = '点击查看酒店房型';
    </script>
</body>
</html> 